﻿using System;

class Student : ICloneable,IComparable<Student>
{
    private string firstName;
    private string secondName;
    private string lastName;
    private int ssn;
    private string address;
    private string mobilePhone;
    private string email;
    private int course;
    private Speciality speciality;
    private Facilty faculty;
    private Univercity univercity;

    public Student(string firstName, string secondName, string lastName, int ssn, string address,
        string mobilePhone, string email, int course, Speciality speciality, Facilty faculty, Univercity univercity)
    {
        this.firstName = firstName;
        this.secondName = secondName;
        this.lastName = lastName;
        this.ssn = ssn;
        this.address = address;
        this.mobilePhone = mobilePhone;
        this.email = email;
        this.course = course;
        this.speciality = speciality;
        this.faculty = faculty;
        this.univercity = univercity;
    }

    public string FirstName
    {
        get
        {
            return firstName;
        }
        set
        {
            firstName = value;
        }
    }

    public string SecondName
    {
        get
        {
            return secondName;
        }
        set
        {
            secondName = value;
        }
    }

    public string LastName
    {
        get
        {
            return lastName;
        }
        set
        {
            lastName = value;
        }
    }

    public int Ssn
    {
        get
        {
            return ssn;
        }
        set
        {
            ssn = value;
        }
    }

    public string Address
    {
        get
        {
            return address;
        }
        set
        {
            address = value;
        }
    }

    public string MobilePhone
    {
        get
        {
            return mobilePhone;
        }
        set
        {
            mobilePhone = value;
        }
    }

    public string Email
    {
        get
        {
            return email;
        }
        set
        {
            email = value;
        }
    }

    public int Course
    {
        get
        {
            return course;
        }
        set
        {
            course = value;
        }
    }

    public Speciality Speciality
    {
        get
        {
            return speciality;
        }
        set
        {
            speciality = value;
        }
    }

    public Facilty Faculty
    {
        get
        {
            return faculty;
        }
        set
        {
            faculty = value;
        }
    }

    public Univercity Univercity
    {
        get
        {
            return univercity;
        }
        set
        {
            univercity = value;
        }
    }

    public override bool Equals(object obj)
    {
        if (obj is Student)
        {
            Student other = obj as Student;
            if (other.Ssn.Equals(this.Ssn))
            {
                return true;
            }
        }
        return false;
    }

    public override int GetHashCode()
    {
        return this.Ssn.GetHashCode() ^ this.MobilePhone.GetHashCode();
    }

    public override string ToString()
    {
        return string.Format("{0} {1} {2} {3} SSN:{4} Phone:{5}",
            firstName, secondName, lastName, ssn, mobilePhone);
    }

    public static bool operator ==(Student first, Student second)
    {
        return first.Ssn.Equals(second.Ssn);
    }

    public static bool operator !=(Student first, Student second)
    {
        return !first.Ssn.Equals(second.Ssn);
    }

    public object Clone()
    {
        return new Student(firstName, secondName, lastName, ssn, address,
         mobilePhone, email, course, speciality, faculty, univercity);
    }

    public int CompareTo(Student other)
    {
        string thisname = firstName + secondName + lastName;
        string othername = other.FirstName + other.SecondName + other.LastName;
        if (thisname.CompareTo(othername)==0)
        {
            return this.Ssn.CompareTo(other.Ssn);
        }
        return thisname.CompareTo(othername);
    }
}
